 mui.init();

 (function($) {

     //阻尼系数
     var deceleration = mui.os.ios ? 0.003 : 0.0009;
     $('.mui-scroll-wrapper').scroll({
         bounce: false,
         indicators: true, //是否显示滚动条
         deceleration: deceleration
     });

     $.ready(function() {
         //循环初始化所有上拉加载。
         $.each(document.querySelectorAll('.mui-slider-group .mui-scroll'), function(index, pullRefreshEl) {
             $(pullRefreshEl).pullToRefresh({
                 up: {
                     auto: true,
                     callback: function() {
                         var self = this;
                         setTimeout(function() {

                             var ul = self.element.querySelector('.mui-table-view');
                             var node = ul.querySelectorAll('li').length;

                             mui.ajax('index.php?act=member_index&op=member_order_list&kind='+(index + 1)+'&nid='+node, {
                                 dataType: 'json',
                                 type: 'get',
                                 timeout: 5000,
                                 success: function(data) {
                                    //console.log(data.feedback)

                                     var len2 = data.feedback.length;
                                     if (len2 > 0) {
                                         for (var p = 1; p <= len2; p++) {

                                             var html3 = data.feedback[p - 1];

                                             if (html3 === "END") {
                                                 self.endPullUpToRefresh(true);
                                             } else {
                                                 ul.appendChild(createFragment(ul, index, html3))
                                                 self.endPullUpToRefresh(false);
                                             }
                                         }

                                     }

                                    btn_load();
                                 },
                                 error: function(msg) {
                                     //console.log(msg)
                                 }
                             });

                         

                         }, 1000);
                     }
                 }


             });




         });

         var createFragment = function(ul, index, html ) {

             var length = ul.querySelectorAll('li').length;
             var fragment = document.createDocumentFragment();
             var li;
             var i = 0;

             li = document.createElement('li');
             li.className = 'mui-table-view-cell';

             li.innerHTML = html
             fragment.appendChild(li);
             
             return fragment;

         };






     });


 })(mui);



document.getElementById("confirmBtn");



function btn_load(){

        $("button").each(function() {
                $(this).unbind();

                $(this).bind("click", function() {

                        var kind = $(this).attr("data-kind");
                        var get = $(this).attr("data-get");

                        mui.confirm("", "是否" + $(this).text() + "?", ['是', '否'], function(e) {
                                if (e.index == 0) {

                                        $.ajax({
                                                type: 'get',
                                                url: get,
                                                dataType: 'json',
                                                success: function(data) {
                                                        //console.log("传输成功！")
                                                        //console.log(data.msg)
                                                        window.open('index.php?act=member_index&op=member_order&kind=' + kind, '_self')
                                                        //btn_load()
                                                },
                                                error: function(data) {
                                                        //console.log(data)
                                                        //window.open('index.php?act=member_index&op=member_order&kind='+kind,'_self')
                                                        //btn_load()
                                                }
                                        });

                                }
                        })

                })
        })
}